package com.yzw.phonestoreservice.pojo;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.UUID;

import lombok.Data;

/**
 * 订单表
 * @TableName order_master
 */
@TableName(value ="order_master")
@Data
public class OrderMaster implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.ASSIGN_ID)  // 默认  也是雪花算法
//    @TableField(fill = FieldFill.INSERT)
    private String orderId;

    /**
     * 买家名字
     */
    private String buyerName;

    /**
     * 买家电话
     */
    private String buyerPhone;

    /**
     * 买家地址
     */
    private String buyerAddress;

    /**
     * 商品编号
     */
    private Integer phoneId;

    /**
     * 商品名称
     */
    private String phoneName;

    /**
     * 商品数量
     */
    private Integer phoneQuantity;

    /**
     * 商品小图
     */
    private String phoneIcon;

    /**
     * 规格编号
     */
    private Integer specsId;

    /**
     * 规格名称
     */
    private String specsName;

    /**
     * 规格单价
     */
    private BigDecimal specsPrice;

    /**
     * 订单总金额
     */
    private BigDecimal orderAmount;

    /**
     * 支付状态，默认0未支付
     */
    @TableField(fill = FieldFill.INSERT)   //  添加  和  修改 都会赋值
    private Integer payStatus;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT,value = "create_time",exist = true)
    private Date createTime;

    /**
     * 修改时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)   //  添加  和  修改 都会赋值
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OrderMaster other = (OrderMaster) that;
        return (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getBuyerName() == null ? other.getBuyerName() == null : this.getBuyerName().equals(other.getBuyerName()))
            && (this.getBuyerPhone() == null ? other.getBuyerPhone() == null : this.getBuyerPhone().equals(other.getBuyerPhone()))
            && (this.getBuyerAddress() == null ? other.getBuyerAddress() == null : this.getBuyerAddress().equals(other.getBuyerAddress()))
            && (this.getPhoneId() == null ? other.getPhoneId() == null : this.getPhoneId().equals(other.getPhoneId()))
            && (this.getPhoneName() == null ? other.getPhoneName() == null : this.getPhoneName().equals(other.getPhoneName()))
            && (this.getPhoneQuantity() == null ? other.getPhoneQuantity() == null : this.getPhoneQuantity().equals(other.getPhoneQuantity()))
            && (this.getPhoneIcon() == null ? other.getPhoneIcon() == null : this.getPhoneIcon().equals(other.getPhoneIcon()))
            && (this.getSpecsId() == null ? other.getSpecsId() == null : this.getSpecsId().equals(other.getSpecsId()))
            && (this.getSpecsName() == null ? other.getSpecsName() == null : this.getSpecsName().equals(other.getSpecsName()))
            && (this.getSpecsPrice() == null ? other.getSpecsPrice() == null : this.getSpecsPrice().equals(other.getSpecsPrice()))
            && (this.getOrderAmount() == null ? other.getOrderAmount() == null : this.getOrderAmount().equals(other.getOrderAmount()))
            && (this.getPayStatus() == null ? other.getPayStatus() == null : this.getPayStatus().equals(other.getPayStatus()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getBuyerName() == null) ? 0 : getBuyerName().hashCode());
        result = prime * result + ((getBuyerPhone() == null) ? 0 : getBuyerPhone().hashCode());
        result = prime * result + ((getBuyerAddress() == null) ? 0 : getBuyerAddress().hashCode());
        result = prime * result + ((getPhoneId() == null) ? 0 : getPhoneId().hashCode());
        result = prime * result + ((getPhoneName() == null) ? 0 : getPhoneName().hashCode());
        result = prime * result + ((getPhoneQuantity() == null) ? 0 : getPhoneQuantity().hashCode());
        result = prime * result + ((getPhoneIcon() == null) ? 0 : getPhoneIcon().hashCode());
        result = prime * result + ((getSpecsId() == null) ? 0 : getSpecsId().hashCode());
        result = prime * result + ((getSpecsName() == null) ? 0 : getSpecsName().hashCode());
        result = prime * result + ((getSpecsPrice() == null) ? 0 : getSpecsPrice().hashCode());
        result = prime * result + ((getOrderAmount() == null) ? 0 : getOrderAmount().hashCode());
        result = prime * result + ((getPayStatus() == null) ? 0 : getPayStatus().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", orderId=").append(orderId);
        sb.append(", buyerName=").append(buyerName);
        sb.append(", buyerPhone=").append(buyerPhone);
        sb.append(", buyerAddress=").append(buyerAddress);
        sb.append(", phoneId=").append(phoneId);
        sb.append(", phoneName=").append(phoneName);
        sb.append(", phoneQuantity=").append(phoneQuantity);
        sb.append(", phoneIcon=").append(phoneIcon);
        sb.append(", specsId=").append(specsId);
        sb.append(", specsName=").append(specsName);
        sb.append(", specsPrice=").append(specsPrice);
        sb.append(", orderAmount=").append(orderAmount);
        sb.append(", payStatus=").append(payStatus);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}